import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
//列表数据
export const columns: BasicColumn[] = [

   {
    title: '试题名称',
    align:"center",
    dataIndex: 'name'
   },
   {
    title: '资源分类',
    align:"center",
    dataIndex: 'categoryName'
   },
   {
    title: '归属部门',
    align:"center",
    dataIndex: 'deptName'
   },
   {
    title: '创建人',
    align:"center",
    dataIndex: 'createdName'
   },
   {
    title: '最后修改人',
    align:"center",
    dataIndex: 'updatedName'
   },
   {
    title: '允许练习',
    align:"center",
    dataIndex: 'allowTest',
    customRender:({value})=>{
      return value?'允许':'不允许';
     }

   },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '数据库自增',
    field: 'autoId',
    component: 'InputNumber',
    show: false,
  },
  {
    label: '试题名称',
    field: 'name',
    component: 'Input',
  },
  {
    label: '资源分类',
    field: 'categoryId',
    component: 'TreeSelect',
    componentProps: {
      replaceFields: {
        value: 'key',
      },
      dropdownStyle: {
        maxHeight: '50vh',
      },
      getPopupContainer: () => document.body,
    },
    show: ({ values }) => {
      return values.pid !== '0';
    },
    dynamicDisabled: ({ values }) => {
      return !!values.id;
    },
  },
  {
    label: '是否允许练习',
    field: 'allowTest',
    component: 'Select',
    componentProps: {
      options: [
        {
          label: '不允许',
          value: '0',
          key: '0',
        },
        {
          label: '允许',
          value: '1',
          key: '1',
        },
      ],
    },

  },
	{
	  label: '',
	  field: 'id',
	  component: 'Input',
	  show: false
	},
  {
    label: '题目',
    field: '0',
    component: 'InputTextArea',
    colProps: {span: 24},
    slot: 'questions',
    required: true,
    defaultValue:'0000',
  }

];



/**
* 流程表单调用这个方法获取formSchema
* @param param
*/
export function getBpmFormSchema(_formData): FormSchema[]{
  // 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
  return formSchema;
}
